<style type="text/css">
.search_detail_default .search_product_title {
    border: 0;
}

.search_detail_default .search_form {
    display: flex;
    display: -webkit-flex;
    justify-content: center;
    padding: 2rem 0;
}

.search_detail_default .search_form form {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

.search_detail_default .search_form .search_product {
    height: 44px;
    width: calc(100% - 155px);
    text-indent: 10px;
    border: 1px solid #707070;
    box-sizing: border-box;
    border-radius: var(--button_border_radius);
}

.search_detail_default .search_form .search_product_btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 140px;
    height: 44px;
    cursor: pointer;
    font-size: 16px;
    text-transform: uppercase;
    border-radius: var(--button_border_radius);
    background-color: var(--main_button_bg);
    color: var(--main_button_color);
}

.search_detail_default .collection_top_bar {
    display: flex;
    display: -webkit-flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 3rem;
    flex-direction: column;
}

.search_detail_default .sort_by {
    display: flex;
    display: -webkit-flex;
    align-items: center;
    margin-top: 2rem;
}

.search_detail_default .sort_by span {
    margin-right: 1rem;
}
.search_detail_default #search_text{
    font-weight: bold;
}

.search_detail_default .sort_by select {
    height: 2.8rem;
    border: 1px solid #d4d4d4;
    cursor: pointer;
}
.search_detail_default .collection_content ul {
    display: grid;
    grid-row-gap: 30px;
    grid-column-gap: 30px;
    grid-template-columns: repeat(4, calc(25% - 22.5px));
}

.search_detail_default .collection_content li {
    list-style-type: none;
    line-height: 1;
    text-align: center;
    width: 100%;
    overflow: hidden;
}


.search_detail_default .collection_content .product_pic {
    margin-bottom: 30px;
     width: 100%;
    overflow: hidden;
    position: relative;
}

.search_detail_default .collection_content .soldout {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 30px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 50px;
    background: rgba(0, 0, 0, .3);
    color: #fff;
    font-size: 14px;
}

.search_detail_default .collection_content .product_pic .product_img {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}

.search_detail_default .collection_content .product_pic img {
    max-width: 100%;
}

.search_detail_default .collection_content .block_product_name {
    margin-bottom: 10px;
    line-height: 1.5;
}
.search_detail_default .collection_content .product_price {
    font-weight: bold;
}

.search_detail_default .collection_content .product_oldprice {
    color: #888;
    text-decoration: line-through;
    margin-left: 5px;
    font-weight: normal;
}
@media (max-width: 1200px) {
    .search_detail_default .collection_content ul{
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 767px) {
    .search_detail_default .search_form{
        padding: 0 0 20px 0;
    }
    .search_detail_default .search_form form {
        width: 100%;
        flex-wrap: wrap;
        height: auto;
    }
    .search_detail_default .search_form .search_product{
        width: 100%;
    }
    .search_detail_default .search_form .search_product_btn{
        margin-top: 15px;
        width: 100%;
    }
    .search_detail_default .collection_content ul {
        grid-row-gap: 15px;
        grid-column-gap: 15px;
        grid-template-columns: repeat(2, 1fr);
    }
    .search_detail_default .collection_content .product_pic{
        margin-bottom: 20px;
    }

}

{% comment %} @media screen and (max-width: 767px) {
    .search_detail_default .discount_tag.label_style_1,
    .search_detail_default .discount_tag.label_style_2,
    .search_detail_default .discount_tag.label_style_3,
    .search_detail_default .discount_tag.label_style_4{
        transform: scale(0.8) translate(20%,-20%);
    }
} {% endcomment %}


</style>
<div class="search_detail_default container_wrapper" id="search_detail">
	<h1 class="title search_product_title">{{lang.search.search}}</h1>
	<div class="search_form">
		<form action="/search" onsubmit="return oemsaasSearch('.search_product')">
			<input class="search_product" value="{{search.keywords}}" type="text" name="q">
			<input class="search_product_btn" style="cursor: pointer;" type="submit" value="{{ lang.general.searchword }}">
		</form>
	</div>
    {% assign searchLangth = search.products | size %}
	{% if search.keywords %}
	<div class="collection_top_bar">
		<div class="product_num" data="{{paginate.items}}">{{paginate.items}} {{lang.search.results_found_for}} {% if search.keywords %}"<span id='search_text'>{{search.keywords}}</span>"{% endif %}</div>
        {% if searchLangth %}
		<div class="sort_by">
			<span>{{ lang.general.sort_by }}</span>
			<select class="form-control"  id='sort_by_select'>
                {% for option in search.sort_options %}
				<option value="{{option.value | default:''}}"  {% if option.value == search.sort_by %}selected="selected"{% endif %}>{{ option.name }}</option>
                {% endfor %}
			</select>
		</div>
        {% endif %}
	</div>
	<div class="collection_content collection_product_wap_2">
        
	    {% if searchLangth %}
		<ul>
			{% for item in search.products %}
			{% include collection_product ,{ product : item } %}
			{% endfor %}

		</ul>
		{% include pagination ,{ paginate : paginate } %}
		{% else %}
		{% include empty ,{text:lang.general.empty }%}

		{% endif %}
	</div>
	{% endif %}
</div>
<script type="text/javascript" src="{{ 'common.js' | public_asset_abs_url }}"></script>

<script type="text/javascript">
	console.log({{ search | json }})
	console.log({{ paginate | json }})
	$(function () {
		$('#sort_by_select').change(function (params) {
			const sort_by = $(this).val();
            location.href = moi.setUrlParams(location.href, { "sort_by": sort_by || "","page": 1});
		})
	})
</script>